package com.aracky.assess.schedule;

import com.aracky.assess.service.PushMsgService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;

import java.time.LocalDateTime;

/**
 * @Author zengzhiping
 * @BelongsPackage com.aracky.system.schedule
 * @CreateTime 2022-08-02
 * @Description 定时任务发送---结束填报日期前2天开始通知评分人（上午9点一次，下午13:30一次）
 */
@Component
public class SendMsgToAssessorJob implements BasicProcessor {
    private static Logger logger = LoggerFactory.getLogger(SendMsgToAssessorJob.class);


    @Autowired
    private PushMsgService pushMsgService;


    @Override
    public ProcessResult process(TaskContext taskContext) throws Exception {
        logger.info("考核人任务发送开始时间：{}", LocalDateTime.now());

        pushMsgService.pushScoreMsgToAssessor();

        return new ProcessResult(true, "考核人任务消息发送成功" + LocalDateTime.now());
    }
}
